package fzrj.qkl.demo.raw;

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.fisco.bcos.sdk.abi.FunctionReturnDecoder;
import org.fisco.bcos.sdk.abi.TypeReference;
import org.fisco.bcos.sdk.abi.datatypes.Bool;
import org.fisco.bcos.sdk.abi.datatypes.DynamicArray;
import org.fisco.bcos.sdk.abi.datatypes.Function;
import org.fisco.bcos.sdk.abi.datatypes.Type;
import org.fisco.bcos.sdk.abi.datatypes.Utf8String;
import org.fisco.bcos.sdk.abi.datatypes.generated.Uint256;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple1;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple2;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple3;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple4;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple6;
import org.fisco.bcos.sdk.client.Client;
import org.fisco.bcos.sdk.contract.Contract;
import org.fisco.bcos.sdk.crypto.CryptoSuite;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.model.CryptoType;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.fisco.bcos.sdk.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;

@SuppressWarnings("unchecked")
public class Shipment extends Contract {
    public static final String[] BINARY_ARRAY = {"608060405260016003556001600455600160055534801561001f57600080fd5b506111268061002f6000396000f3006080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063092b3740146100bf57806318b8275a1461025257806341c65276146102bb5780634de5265114610300578063595b1a3e146103825780635c622a0e146103ad5780635df2d36814610453578063723331bb146105165780638594a4ba1461055b578063940fb60614610586578063a2d9d6b0146105b1578063fe5f937e1461062e575b600080fd5b3480156100cb57600080fd5b506100ea600480360381019080803590602001909291905050506106dd565b60405180878152602001806020018060200180602001868152602001858152602001848103845289818151815260200191508051906020019080838360005b83811015610144578082015181840152602081019050610129565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b50848103835288818151815260200191508051906020019080838360005b838110156101aa57808201518184015260208101905061018f565b50505050905090810190601f1680156101d75780820380516001836020036101000a031916815260200191505b50848103825287818151815260200191508051906020019080838360005b838110156102105780820151818401526020810190506101f5565b50505050905090810190601f16801561023d5780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b34801561025e57600080fd5b506102b9600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610973565b005b3480156102c757600080fd5b506102e660048036038101908080359060200190929190505050610a01565b604051808215151515815260200191505060405180910390f35b34801561030c57600080fd5b5061032b60048036038101908080359060200190929190505050610a24565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561036e578082015181840152602081019050610353565b505050509050019250505060405180910390f35b34801561038e57600080fd5b50610397610a9e565b6040518082815260200191505060405180910390f35b3480156103b957600080fd5b506103d860048036038101908080359060200190929190505050610aab565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104185780820151818401526020810190506103fd565b50505050905090810190601f1680156104455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561045f57600080fd5b506105146004803603810190808035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610b70565b005b34801561052257600080fd5b5061054160048036038101908080359060200190929190505050610d21565b604051808215151515815260200191505060405180910390f35b34801561056757600080fd5b50610570610d43565b6040518082815260200191505060405180910390f35b34801561059257600080fd5b5061059b610d50565b6040518082815260200191505060405180910390f35b3480156105bd57600080fd5b5061062c6004803603810190808035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610d5d565b005b34801561063a57600080fd5b506106db600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610dd7565b005b600060608060606000806106ef610eff565b60026001890381548110151561070157fe5b90600052602060002090600802016101006040519081016040529081600082015481526020016001820154815260200160028201548152602001600382018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107d35780601f106107a8576101008083540402835291602001916107d3565b820191906000526020600020905b8154815290600101906020018083116107b657829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108755780601f1061084a57610100808354040283529160200191610875565b820191906000526020600020905b81548152906001019060200180831161085857829003601f168201915b50505050508152602001600582018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109175780601f106108ec57610100808354040283529160200191610917565b820191906000526020600020905b8154815290600101906020018083116108fa57829003601f168201915b505050505081526020016006820154815260200160078201548152505090508060000151816060015182608001518360a001518460c001518560e001518494508393508292509650965096509650965096505091939550919395565b61097b610f45565b604080519081016040528060035481526020018381525090506001600360008282540192505081905550600081908060018154018082558091505090600182039060005260206000209060020201600090919290919091506000820151816000015560208201518160010190805190602001906109f9929190610f5f565b505050505050565b600060018054905082111515610a1a5760019050610a1f565b600090505b919050565b60606001808303815481101515610a3757fe5b9060005260206000209060040201600301805480602002602001604051908101604052809291908181526020018280548015610a9257602002820191906000526020600020905b815481526020019060010190808311610a7e575b50505050509050919050565b6000600160035403905090565b6060600260018303815481101515610abf57fe5b90600052602060002090600802016005018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b645780601f10610b3957610100808354040283529160200191610b64565b820191906000526020600020905b815481529060010190602001808311610b4757829003601f168201915b50505050509050919050565b6000610b7a610eff565b610b8386610d21565b91508115610d19576001808603815481101515610b9c57fe5b906000526020600020906004020160030160055490806001815401808255809150509060018203906000526020600020016000909192909190915055506101006040519081016040528060055481526020018781526020018681526020018581526020018481526020016040805190810160405280600981526020017fe5be85e58f91e8b4a7000000000000000000000000000000000000000000000081525081526020014281526020014281525090506001600560008282540192505081905550600281908060018154018082558091505090600182039060005260206000209060080201600090919290919091506000820151816000015560208201518160010155604082015181600201556060820151816003019080519060200190610cc6929190610f5f565b506080820151816004019080519060200190610ce3929190610f5f565b5060a0820151816005019080519060200190610d00929190610f5f565b5060c0820151816006015560e082015181600701555050505b505050505050565b6000808054905082111515610d395760019050610d3e565b600090505b919050565b6000600160035403905090565b6000600160035403905090565b6000610d6884610a01565b90508015610dd15781600260018503815481101515610d8357fe5b90600052602060002090600802016005019080519060200190610da7929190610fdf565b5042600260018503815481101515610dbb57fe5b9060005260206000209060080201600701819055505b50505050565b6000610de161105f565b608060405190810160405280600454815260200185815260200184815260200183805480602002602001604051908101604052809291908181526020018280548015610e4c57602002820191906000526020600020905b815481526020019060010190808311610e38575b50505050508152509050600160046000828254019250508190555060018190806001815401808255809150509060018203906000526020600020906004020160009091929091909150600082015181600001556020820151816001019080519060200190610ebb929190610f5f565b506040820151816002019080519060200190610ed8929190610f5f565b506060820151816003019080519060200190610ef5929190611088565b5050505050505050565b6101006040519081016040528060008152602001600081526020016000815260200160608152602001606081526020016060815260200160008152602001600081525090565b604080519081016040528060008152602001606081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610fa057805160ff1916838001178555610fce565b82800160010185558215610fce579182015b82811115610fcd578251825591602001919060010190610fb2565b5b5090","50610fdb91906110d5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061102057805160ff191683800117855561104e565b8280016001018555821561104e579182015b8281111561104d578251825591602001919060010190611032565b5b50905061105b91906110d5565b5090565b608060405190810160405280600081526020016060815260200160608152602001606081525090565b8280548282559060005260206000209081019282156110c4579160200282015b828111156110c35782518255916020019190600101906110a8565b5b5090506110d191906110d5565b5090565b6110f791905b808211156110f35760008160009055506001016110db565b5090565b905600a165627a7a723058207fddd18b9900cbffd70337f1b5ec68592f932e6cffcccc60321f718cfff8789b0029"};

    public static final String BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {};

    public static final String SM_BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {"[{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"getShipment\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"addUser\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"checkCarrier\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"getShipmentsByCarrier\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getUsersLength\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"},{\"name\":\"_carrier_id\",\"type\":\"uint256\"},{\"name\":\"_from\",\"type\":\"string\"},{\"name\":\"_to\",\"type\":\"string\"}],\"name\":\"addShipment\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"checkUser\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getCarriersLength\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getShipmentsLength\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_id_carrier\",\"type\":\"uint256\"},{\"name\":\"_id_shipment\",\"type\":\"uint256\"},{\"name\":\"_status\",\"type\":\"string\"}],\"name\":\"updateStatus\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"string\"},{\"name\":\"_info\",\"type\":\"string\"}],\"name\":\"addCarrier\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"};

    public static final String ABI = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_GETSHIPMENT = "getShipment";

    public static final String FUNC_ADDUSER = "addUser";

    public static final String FUNC_CHECKCARRIER = "checkCarrier";

    public static final String FUNC_GETSHIPMENTSBYCARRIER = "getShipmentsByCarrier";

    public static final String FUNC_GETUSERSLENGTH = "getUsersLength";

    public static final String FUNC_GETSTATUS = "getStatus";

    public static final String FUNC_ADDSHIPMENT = "addShipment";

    public static final String FUNC_CHECKUSER = "checkUser";

    public static final String FUNC_GETCARRIERSLENGTH = "getCarriersLength";

    public static final String FUNC_GETSHIPMENTSLENGTH = "getShipmentsLength";

    public static final String FUNC_UPDATESTATUS = "updateStatus";

    public static final String FUNC_ADDCARRIER = "addCarrier";

    protected Shipment(String contractAddress, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public Tuple6<BigInteger, String, String, String, BigInteger, BigInteger> getShipment(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_GETSHIPMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple6<BigInteger, String, String, String, BigInteger, BigInteger>(
                (BigInteger) results.get(0).getValue(), 
                (String) results.get(1).getValue(), 
                (String) results.get(2).getValue(), 
                (String) results.get(3).getValue(), 
                (BigInteger) results.get(4).getValue(), 
                (BigInteger) results.get(5).getValue());
    }

    public TransactionReceipt addUser(String _name) {
        final Function function = new Function(
                FUNC_ADDUSER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void addUser(String _name, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_ADDUSER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name)), 
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForAddUser(String _name) {
        final Function function = new Function(
                FUNC_ADDUSER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple1<String> getAddUserInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_ADDUSER, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<String>(

                (String) results.get(0).getValue()
                );
    }

    public Boolean checkCarrier(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_CHECKCARRIER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        return executeCallWithSingleValueReturn(function, Boolean.class);
    }

    public List getShipmentsByCarrier(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_GETSHIPMENTSBYCARRIER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Uint256>>() {}));
        List<Type> result = (List<Type>) executeCallWithSingleValueReturn(function, List.class);
        return convertToNative(result);
    }

    public BigInteger getUsersLength() throws ContractException {
        final Function function = new Function(FUNC_GETUSERSLENGTH, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public String getStatus(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_GETSTATUS, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
        return executeCallWithSingleValueReturn(function, String.class);
    }

    public TransactionReceipt addShipment(BigInteger _id, BigInteger _carrier_id, String _from, String _to) {
        final Function function = new Function(
                FUNC_ADDSHIPMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_carrier_id), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_from), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_to)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void addShipment(BigInteger _id, BigInteger _carrier_id, String _from, String _to, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_ADDSHIPMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_carrier_id), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_from), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_to)), 
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForAddShipment(BigInteger _id, BigInteger _carrier_id, String _from, String _to) {
        final Function function = new Function(
                FUNC_ADDSHIPMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_carrier_id), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_from), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_to)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple4<BigInteger, BigInteger, String, String> getAddShipmentInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_ADDSHIPMENT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple4<BigInteger, BigInteger, String, String>(

                (BigInteger) results.get(0).getValue(), 
                (BigInteger) results.get(1).getValue(), 
                (String) results.get(2).getValue(), 
                (String) results.get(3).getValue()
                );
    }

    public Boolean checkUser(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_CHECKUSER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        return executeCallWithSingleValueReturn(function, Boolean.class);
    }

    public BigInteger getCarriersLength() throws ContractException {
        final Function function = new Function(FUNC_GETCARRIERSLENGTH, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public BigInteger getShipmentsLength() throws ContractException {
        final Function function = new Function(FUNC_GETSHIPMENTSLENGTH, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public TransactionReceipt updateStatus(BigInteger _id_carrier, BigInteger _id_shipment, String _status) {
        final Function function = new Function(
                FUNC_UPDATESTATUS, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_carrier), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_shipment), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_status)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void updateStatus(BigInteger _id_carrier, BigInteger _id_shipment, String _status, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_UPDATESTATUS, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_carrier), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_shipment), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_status)), 
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForUpdateStatus(BigInteger _id_carrier, BigInteger _id_shipment, String _status) {
        final Function function = new Function(
                FUNC_UPDATESTATUS, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_carrier), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_shipment), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_status)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple3<BigInteger, BigInteger, String> getUpdateStatusInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_UPDATESTATUS, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple3<BigInteger, BigInteger, String>(

                (BigInteger) results.get(0).getValue(), 
                (BigInteger) results.get(1).getValue(), 
                (String) results.get(2).getValue()
                );
    }

    public TransactionReceipt addCarrier(String _name, String _info) {
        final Function function = new Function(
                FUNC_ADDCARRIER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_info)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void addCarrier(String _name, String _info, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_ADDCARRIER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_info)), 
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForAddCarrier(String _name, String _info) {
        final Function function = new Function(
                FUNC_ADDCARRIER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_info)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<String, String> getAddCarrierInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_ADDCARRIER, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<String, String>(

                (String) results.get(0).getValue(), 
                (String) results.get(1).getValue()
                );
    }

    public static Shipment load(String contractAddress, Client client, CryptoKeyPair credential) {
        return new Shipment(contractAddress, client, credential);
    }

    public static Shipment deploy(Client client, CryptoKeyPair credential) throws ContractException {
        return deploy(Shipment.class, client, credential, getBinary(client.getCryptoSuite()), "");
    }
}
